//
//  XMWaitMeetOrderView.m
//  XMJJ_zml
//
//  Created by 丁浩 on 2025/6/19.
//

#import "XMWaitMeetOrderView.h"

@interface XMWaitMeetOrderView ()

@property (nonatomic, strong) UIScrollView *bodyScrollView;
@property (nonatomic, strong) UILabel *statusLabel;
@property (nonatomic, strong) UIImageView *qrCodeImgView;
@property (nonatomic, strong) NSTimer *timer;

@property (nonatomic, strong) UILabel *addressLabel;

@property (nonatomic, strong) UIImageView *avatarImgView;
@property (nonatomic, strong) UILabel *nameLabel;
@property (nonatomic, strong) UIImageView *coverImgView;
@property (nonatomic, strong) UILabel *titleLabel;
@property (nonatomic, strong) UILabel *startTimeLabel;
@property (nonatomic, strong) UILabel *endTimeLabel;
@property (nonatomic, strong) UILabel *totalPriceLabel;

@property (nonatomic, strong) UILabel *orderNoLabel;
@property (nonatomic, strong) UILabel *orderTimeLabel;
@property (nonatomic, strong) UILabel *getTimeLabel;

@property (nonatomic, strong) XMOrderDetailModel *orderDetailModel;

@end

@implementation XMWaitMeetOrderView

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        [self creatUI];
    }
    return self;
}

- (void)creatUI {
    [self addSubview:self.navView];
    self.navTitleLabel.text = @"待见面";
    self.backgroundColor = kColorHEX(0xf0f0f0);
    [self addSubview:self.statusLabel];
    [self addSubview:self.bodyScrollView];
    //二维码信息
    UIView *qrcodeBgView = [[UIView alloc] initWithFrame:CGRectMake(0, KScaleWidth(10.0), self.width, KScaleWidth(332.0))];
    qrcodeBgView.backgroundColor = kColorHEX(0xffffff);
    [_bodyScrollView addSubview:qrcodeBgView];
    {
        UIImageView *qrcodeBgImgView = [[UIImageView alloc] initWithFrame:CGRectMake((self.width - KScaleWidth(256.0))/2, KScaleWidth(23.0), KScaleWidth(256.0), KScaleWidth(285.0))];
        qrcodeBgImgView.image = ImageNamed(@"order_detail_qrcode_bg_img");
        qrcodeBgImgView.userInteractionEnabled = YES;
        [qrcodeBgView addSubview:qrcodeBgImgView];
        
        UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, KScaleWidth(8.0), qrcodeBgImgView.width, KScaleWidth(25.0)) font:KBoldFontSize(18.0) textColor:kColorHEX(0xffffff) textAlignment:NSTextAlignmentCenter];
        titleLabel.text = @"见面码";
        [qrcodeBgImgView addSubview:titleLabel];
        UILabel *subTitleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, titleLabel.maxY, titleLabel.width, KScaleWidth(20.0)) font:KFontSize(14.0) textColor:kColorHEX(0xffffff) textAlignment:NSTextAlignmentCenter];
        subTitleLabel.text = @"对方扫码核销后见面开始";
        [qrcodeBgImgView addSubview:subTitleLabel];
        
        UIButton *saveImgBtn = [UIButton buttonWithType:UIButtonTypeCustom font:KFontSize(15.0) frame:CGRectMake((qrcodeBgImgView.width - KScaleWidth(190.0))/2, qrcodeBgImgView.height - KScaleWidth(27.0) - KScaleWidth(35.0), KScaleWidth(190.0), KScaleWidth(35.0)) title:@"保存见面码到手价" titleColor:kColorHEX(0x333333) image:@"order_detail_save_img_icon"];
        [saveImgBtn layoutButtonWithEdgeInsetsStyle:CSButtonEdgeInsetsStyleLeft ImageTitleSpace:KScaleWidth(10.0)];
        [saveImgBtn addTarget:self action:@selector(saveImgAction:) forControlEvents:UIControlEventTouchUpInside];
        [saveImgBtn setGradientLayerWithLocations:@[@(0), @(1.0)] colors:@[(__bridge id)kColorHEX(0xFFD800).CGColor, (__bridge id)kColorHEX(0xFFE44E).CGColor] startPoint:CGPointMake(0.5, 0.37) endPoint:CGPointMake(0.03, 0.37)];
        [saveImgBtn setCornerRadius:saveImgBtn.height/2];
        [qrcodeBgImgView addSubview:saveImgBtn];
        [qrcodeBgImgView addSubview:self.qrCodeImgView];
    }
    //地址信息
    UIImageView *addressBgImg = [[UIImageView alloc] initWithFrame:CGRectMake(0, qrcodeBgView.maxY + KScaleWidth(8.0), self.width, KScaleWidth(76.0))];
    addressBgImg.image = ImageNamed(@"order_detail_address_img");
    [_bodyScrollView addSubview:addressBgImg];
    {
        UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(KScaleWidth(16.0), KScaleWidth(12.0), addressBgImg.width - KScaleWidth(16.0)*2, KScaleWidth(20.0)) font:KFontSize(18.0) textColor:kColorHEX(0x333333)];
        titleLabel.text = @"见面地点";
        [addressBgImg addSubview:titleLabel];
        [addressBgImg addSubview:self.addressLabel];
    }
    //见面包信息
    UIView *meetInfoBgView = [[UIView alloc] initWithFrame:CGRectMake(0, addressBgImg.maxY + KScaleWidth(8.0), self.width, KScaleWidth(204.0))];
    meetInfoBgView.backgroundColor = kColorHEX(0xffffff);
    [_bodyScrollView addSubview:meetInfoBgView];
    {
        [meetInfoBgView addSubview:self.avatarImgView];
        [meetInfoBgView addSubview:self.nameLabel];
        [meetInfoBgView addSubview:self.coverImgView];
        [meetInfoBgView addSubview:self.titleLabel];
        [meetInfoBgView addSubview:self.startTimeLabel];
        [meetInfoBgView addSubview:self.endTimeLabel];
        [meetInfoBgView addSubview:self.totalPriceLabel];
        UIButton *contactBtn = [UIButton buttonWithType:UIButtonTypeCustom font:KBoldFontSize(14.0) frame:CGRectMake(self.width - KScaleWidth(16.0) - KScaleWidth(90.0), _nameLabel.y + (_nameLabel.height - KScaleWidth(38.0))/2, KScaleWidth(90.0), KScaleWidth(38.0)) title:@"联系对方" titleColor:kColorHEX(0x333333)];
        [contactBtn setGradientLayerWithLocations:@[@(0), @(1.0)] colors:@[(__bridge id)kColorHEX(0xFFD800).CGColor, (__bridge id)kColorHEX(0xFFE44E).CGColor] startPoint:CGPointMake(0.5, 0.37) endPoint:CGPointMake(0.03, 0.37)];
        [contactBtn setCornerRadius:contactBtn.height/2];
        [contactBtn addTarget:self action:@selector(contactAction:) forControlEvents:UIControlEventTouchUpInside];
        [meetInfoBgView addSubview:contactBtn];
        
        UILabel *startTitleLabel = [[UILabel alloc] initWithFrame:CGRectMake(_coverImgView.maxX + KScaleWidth(8.0), _startTimeLabel.y, KScaleWidth(60.0), _startTimeLabel.height) font:KFontSize(13.0) textColor:kColorHEX(0x666666)];
        startTitleLabel.text = @"开始时间";
        [meetInfoBgView addSubview:startTitleLabel];
        UILabel *endTitleLabel = [[UILabel alloc] initWithFrame:CGRectMake(_coverImgView.maxX + KScaleWidth(8.0), _endTimeLabel.y, KScaleWidth(60.0), _endTimeLabel.height) font:KFontSize(13.0) textColor:kColorHEX(0x666666)];
        endTitleLabel.text = @"结束时间";
        [meetInfoBgView addSubview:endTitleLabel];
    }
    //订单信息
    UIView *orderInfoBgView = [[UIView alloc] initWithFrame:CGRectMake(0, meetInfoBgView.maxY + KScaleWidth(8.0), self.width, KScaleWidth(116.0))];
    orderInfoBgView.backgroundColor = kColorHEX(0xffffff);
    [_bodyScrollView addSubview:orderInfoBgView];
    {
        NSArray *titleArr = @[@"订单编号：", @"下单时间：", @"领取时间："];
        for (int i = 0; i < titleArr.count; i ++) {
            UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(KScaleWidth(16.0), KScaleWidth(16.0) + KScaleWidth(30.0)*i, KScaleWidth(106.0), KScaleWidth(30.0)) font:KFontSize(15.0) textColor:kColorHEX(0x666666)];
            titleLabel.text = titleArr[i];
            [orderInfoBgView addSubview:titleLabel];
        }
        UIButton *copyBtn = [UIButton buttonWithType:UIButtonTypeCustom font:KFontSize(15.0) frame:CGRectMake(orderInfoBgView.width - KScaleWidth(16.0) - KScaleWidth(54.0), KScaleWidth(16.0) + (KScaleWidth(30.0) - KScaleWidth(24.0))/2, KScaleWidth(54.0), KScaleWidth(24.0)) title:@"复制" titleColor:kColorHEX(0x666666)];
        [copyBtn setRadius:copyBtn.height/2 borderColor:kColorHEX(0xCCCCCC) borderWidth:1];
        [copyBtn addTarget:self action:@selector(copyAction:) forControlEvents:UIControlEventTouchUpInside];
        [orderInfoBgView addSubview:copyBtn];
        [orderInfoBgView addSubview:self.orderNoLabel];
        [orderInfoBgView addSubview:self.orderTimeLabel];
        [orderInfoBgView addSubview:self.getTimeLabel];
    }
    
    UIButton *giveBtn = [UIButton buttonWithType:UIButtonTypeCustom font:KFontSize(15.0) frame:CGRectMake(self.width - KScaleWidth(210.0) - KScaleWidth(90.0), orderInfoBgView.maxY + KScaleWidth(16.0), KScaleWidth(90.0), KScaleWidth(38.0)) title:@"赠送" titleColor:kColorHEX(0x333333)];
    [giveBtn setRadius:giveBtn.height/2 borderColor:kColorHEX(0x979797) borderWidth:1];
    [giveBtn addTarget:self action:@selector(giveAction:) forControlEvents:UIControlEventTouchUpInside];
    [_bodyScrollView addSubview:giveBtn];
    
    UIButton *returnBtn = [UIButton buttonWithType:UIButtonTypeCustom font:KFontSize(15.0) frame:CGRectMake(self.width - KScaleWidth(112.0) - KScaleWidth(90.0), orderInfoBgView.maxY + KScaleWidth(16.0), KScaleWidth(90.0), KScaleWidth(38.0)) title:@"申请退款" titleColor:kColorHEX(0x333333)];
    [returnBtn setRadius:returnBtn.height/2 borderColor:kColorHEX(0x979797) borderWidth:1];
    [returnBtn addTarget:self action:@selector(returnAction:) forControlEvents:UIControlEventTouchUpInside];
    [_bodyScrollView addSubview:returnBtn];
    
    UIButton *resellBtn = [UIButton buttonWithType:UIButtonTypeCustom font:KBoldFontSize(14.0) frame:CGRectMake(self.width - KScaleWidth(16.0) - KScaleWidth(90.0), returnBtn.y, KScaleWidth(90.0), KScaleWidth(38.0)) title:@"转卖" titleColor:kColorHEX(0x333333)];
    [resellBtn setGradientLayerWithLocations:@[@(0), @(1.0)] colors:@[(__bridge id)kColorHEX(0xFFD800).CGColor, (__bridge id)kColorHEX(0xFFE44E).CGColor] startPoint:CGPointMake(0.5, 0.37) endPoint:CGPointMake(0.03, 0.37)];
    [resellBtn setCornerRadius:resellBtn.height/2];
    [resellBtn addTarget:self action:@selector(resellAction:) forControlEvents:UIControlEventTouchUpInside];
    [_bodyScrollView addSubview:resellBtn];
    _bodyScrollView.contentSize = CGSizeMake(_bodyScrollView.width, MAX(_bodyScrollView.height, resellBtn.maxY + kBottomLayout));
}

- (void)setContentWithOrderDetailModel:(XMOrderDetailModel *)orderDetailModel {
    _orderDetailModel = orderDetailModel;
    CIImage *ciImg = [self df_createQRcodeWithUrlstring:orderDetailModel.seeNo];
    _qrCodeImgView.image = [self df_createNonInterpolatedUIImageFormCIImage:ciImg withSize:_qrCodeImgView.width];
    _addressLabel.text = orderDetailModel.address;
    [_avatarImgView sd_setImageWithURL:[NSURL URLWithString:orderDetailModel.avatar] placeholderImage:ImageNamed(@"mine_avatar_icon")];
    _nameLabel.text = orderDetailModel.nickname;
    [_coverImgView sd_setImageWithURL:[NSURL URLWithString:orderDetailModel.coverImageUrl]];
    _titleLabel.text = orderDetailModel.title;
    _startTimeLabel.text = [[NSDate dateWithTimeIntervalSince1970:[orderDetailModel.startTime integerValue]/1000] dateStringWithFormat:@"yyyy.MM.dd HH:mm"];
    _endTimeLabel.text = [[NSDate dateWithTimeIntervalSince1970:[orderDetailModel.endTime integerValue]/1000] dateStringWithFormat:@"yyyy.MM.dd HH:mm"];
    if (!orderDetailModel.startSeeTime) {
        orderDetailModel.startSeeTime = @"0";
    }
    _getTimeLabel.text = [[NSDate dateWithTimeIntervalSince1970:[orderDetailModel.startSeeTime integerValue]/1000] dateStringWithFormat:@"yyyy.MM.dd HH:mm"];
    NSString *priceStr = [NSString stringWithFormat:@"总价 ¥%@", orderDetailModel.yinfuPrice];
    NSMutableAttributedString *priceAttr = [[NSMutableAttributedString alloc] initWithString:priceStr attributes:@{NSFontAttributeName : KBoldFontSize(18.0), NSForegroundColorAttributeName : kColorHEX(0xDD4B39)}];
    [priceAttr addAttributes:@{NSForegroundColorAttributeName : kColorHEX(0x666666), NSFontAttributeName : KFontSize(15.0)} range:NSMakeRange(0, 2)];
    [_totalPriceLabel setAttributedText:priceAttr];
    _orderNoLabel.text = orderDetailModel.orderNo;
    _orderTimeLabel.text = [[NSDate dateWithTimeIntervalSince1970:[orderDetailModel.orderTime integerValue]/1000] dateStringWithFormat:@"yyyy.MM.dd HH:mm"];
    if (_timer) {
        [_timer invalidate];
    }
    _timer = [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(setCountDownTimeWithStartTime:) userInfo:orderDetailModel.startTime repeats:YES];
}

- (void)setCountDownTimeWithStartTime:(NSTimer *)timer {
    NSInteger currentTimeinterval = [[NSDate date] timeIntervalSince1970];
    NSInteger spaceTime = [timer.userInfo integerValue] - currentTimeinterval;
    if (spaceTime < (60*60*24*6) && spaceTime > 0) {
        if (spaceTime > 60*60) {
            _statusLabel.text = [NSString stringWithFormat:@"距离见面开始时间还剩%ld:%ld:%ld", spaceTime/60/60, spaceTime/60%60, spaceTime%60];
        }
        else if (spaceTime > 60) {
            _statusLabel.text = [NSString stringWithFormat:@"距离见面开始时间还剩%ld:%ld", spaceTime/60, spaceTime%60];
        }
        else {
            _statusLabel.text = [NSString stringWithFormat:@"距离见面开始时间还剩%ld:%ld", spaceTime/60, spaceTime%60];
        }
        _statusLabel.text = [NSString stringWithFormat:@"距离见面开始时间还剩%ld:%ld", spaceTime/60, spaceTime%60];
    }
    else {
        _statusLabel.text = @"见面已超时";
        [timer invalidate];
    }
}

//保存
- (void)saveImgAction:(UIButton *)button {
    if (self.delegate && [self.delegate respondsToSelector:@selector(saveWithImg:)]) {
        [self.delegate saveWithImg:self.qrCodeImgView.image];
    }
}

//复制
- (void)copyAction:(UIButton *)button {
    UIPasteboard *pab = [UIPasteboard generalPasteboard];
    pab.string = _orderNoLabel.text;
    if ([pab.string isEqualToString:_orderNoLabel.text]) {
        [MBProgressHUD showSuccess:@"已复制到剪切板"];
    }
}

//联系
- (void)contactAction:(UIButton *)button {
    if (self.delegate && [self.delegate respondsToSelector:@selector(contactWithUserPhone:)]) {
        [self.delegate contactWithUserPhone:_orderDetailModel.phone];
    }
}

//退款
- (void)returnAction:(UIButton *)button {
    if (self.delegate && [self.delegate respondsToSelector:@selector(returnWithOrderDetailModel:)]) {
        [self.delegate returnWithOrderDetailModel:self.orderDetailModel];
    }
}

//转卖
- (void)resellAction:(UIButton *)button {
    if (self.delegate && [self.delegate respondsToSelector:@selector(resellWithOrderId:serviceId:)]) {
        [self.delegate resellWithOrderId:self.orderDetailModel.orderId
                               serviceId:self.orderDetailModel.serviceId];
    }
}

//赠送
- (void)giveAction:(UIButton *)button {
    if (self.delegate && [self.delegate respondsToSelector:@selector(giveWithOrderId:)]) {
        [self.delegate giveWithOrderId:self.orderDetailModel.orderId];
    }
}

- (CIImage *)df_createQRcodeWithUrlstring:(NSString *)urlString {
      // 1.实例化二维码滤镜
    CIFilter *filter = [CIFilter filterWithName:@"CIQRCodeGenerator"];
    // 2.恢复滤镜的默认属性 (因为滤镜有可能保存上一次的属性)
    // 3.将字符串转换成NSdata
    NSData*data = [urlString dataUsingEncoding:NSUTF8StringEncoding];
    // 4.通过KVO设置滤镜, 传入data, 将来滤镜就知道要通过传入的数据生成二维码
    [filter setValue:data forKey:@"inputMessage"];
    // 5.生成二维码
    CIImage*outputImage = [filter outputImage];
    return outputImage;
}

- (UIImage *)df_createNonInterpolatedUIImageFormCIImage:(CIImage *)image
                                               withSize:(CGFloat)size {

    CGRect extent = CGRectIntegral(image.extent);
    CGFloat scale = MIN(size/CGRectGetWidth(extent), size/CGRectGetHeight(extent));
    // 1.创建bitmap;
    size_t width = CGRectGetWidth(extent) * scale;
    size_t height = CGRectGetHeight(extent) * scale;
    CGColorSpaceRef cs = CGColorSpaceCreateDeviceGray();
    CGContextRef bitmapRef = CGBitmapContextCreate(nil, width, height, 8, 0, cs, (CGBitmapInfo)kCGImageAlphaNone);
    CIContext *context = [CIContext contextWithOptions:nil];
    CGImageRef bitmapImage = [context createCGImage:image fromRect:extent];
    CGContextSetInterpolationQuality(bitmapRef, kCGInterpolationNone);
    CGContextScaleCTM(bitmapRef, scale, scale);
    CGContextDrawImage(bitmapRef, extent, bitmapImage);
    // 2.保存bitmap到图片
    CGImageRef scaledImage = CGBitmapContextCreateImage(bitmapRef);
    CGContextRelease(bitmapRef);
    CGImageRelease(bitmapImage);
    return [UIImage imageWithCGImage:scaledImage];
}

#pragma mark - Init
- (UIScrollView *)bodyScrollView {
    if (!_bodyScrollView) {
        _bodyScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, kNavagationBarH + KScaleWidth(40.0), self.width, self.height - kNavagationBarH - KScaleWidth(40.0))];
        _bodyScrollView.backgroundColor = kColorHEX(0xf0f0f0);
    }
    return _bodyScrollView;
}

- (UILabel *)statusLabel {
    if (!_startTimeLabel) {
        _statusLabel = [[UILabel alloc] initWithFrame:CGRectMake(KScaleWidth(26.0), kNavagationBarH, self.width - KScaleWidth(26.0)*2, KScaleWidth(40.0)) font:KFontSize(14.0) textColor:kColorHEX(0x666666)];
    }
    return _statusLabel;
}

- (UIImageView *)qrCodeImgView {
    if (!_qrCodeImgView) {
        _qrCodeImgView = [[UIImageView alloc] initWithFrame:CGRectMake((KScaleWidth(256.0) - KScaleWidth(105.0))/2, KScaleWidth(86.0), KScaleWidth(105.0), KScaleWidth(105.0))];
    }
    return _qrCodeImgView;
}

- (UILabel *)addressLabel {
    if (!_addressLabel) {
        _addressLabel = [[UILabel alloc] initWithFrame:CGRectMake(KScaleWidth(16.0), KScaleWidth(40.0), self.width - KScaleWidth(16.0)*2, KScaleWidth(20.0)) font:KFontSize(16.0) textColor:kColorHEX(0x666666)];
//        _addressLabel.backgroundColor = kColorHEX(0x00ffff);
    }
    return _addressLabel;
}

- (UIImageView *)avatarImgView {
    if (!_avatarImgView) {
        _avatarImgView = [[UIImageView alloc] initWithFrame:CGRectMake(KScaleWidth(15.0), KScaleWidth(16.0), KScaleWidth(36.0), KScaleWidth(36.0))];
        [_avatarImgView setCornerRadius:_avatarImgView.height/2];
    }
    return _avatarImgView;
}

- (UILabel *)nameLabel {
    if (!_nameLabel) {
        _nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.avatarImgView.maxX + KScaleWidth(8.0), _avatarImgView.y, self.width - _avatarImgView.maxX - KScaleWidth(8.0) - KScaleWidth(90.0) - KScaleWidth(16.0), _avatarImgView.height) font:KFontSize(18.0) textColor:kColorHEX(0x333333)];
    }
    return _nameLabel;
}

- (UIImageView *)coverImgView {
    if (!_coverImgView) {
        _coverImgView = [[UIImageView alloc] initWithFrame:CGRectMake(KScaleWidth(15.0), KScaleWidth(68.0), KScaleWidth(80.0), KScaleWidth(80.0))];
    }
    return _coverImgView;
}

- (UILabel *)titleLabel {
    if (!_titleLabel) {
        _titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.coverImgView.maxX + KScaleWidth(8.0), _coverImgView.y, self.width - _coverImgView.maxX - KScaleWidth(8.0), KScaleWidth(30.0)) font:KFontSize(16.0) textColor:kColorHEX(0x333333)];
    }
    return _titleLabel;
}

- (UILabel *)startTimeLabel {
    if (!_startTimeLabel) {
        _startTimeLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.coverImgView.maxX + KScaleWidth(70.0), self.titleLabel.maxY + KScaleWidth(5.0), self.width - _coverImgView.maxX - KScaleWidth(70.0), KScaleWidth(24.0)) font:KFontSize(13.0) textColor:kColorHEX(0x666666)];
    }
    return _startTimeLabel;
}

- (UILabel *)endTimeLabel {
    if (!_endTimeLabel) {
        _endTimeLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.startTimeLabel.x, _startTimeLabel.maxY, _startTimeLabel.width, _startTimeLabel.height) font:KFontSize(13.0) textColor:kColorHEX(0x666666)];
    }
    return _endTimeLabel;
}

- (UILabel *)totalPriceLabel {
    if (!_totalPriceLabel) {
        _totalPriceLabel = [[UILabel alloc] initWithFrame:CGRectMake(KScaleWidth(16.0), self.startTimeLabel.maxY + KScaleWidth(10.0), self.width - KScaleWidth(16.0)*2, KScaleWidth(32.0))];
        _totalPriceLabel.textAlignment = NSTextAlignmentRight;
    }
    return _totalPriceLabel;
}

- (UILabel *)orderNoLabel {
    if (!_orderNoLabel) {
        _orderNoLabel = [[UILabel alloc] initWithFrame:CGRectMake(KScaleWidth(100.0), KScaleWidth(16.0), self.width - KScaleWidth(100.0) - KScaleWidth(82.0), KScaleWidth(30.0)) font:KFontSize(15.0) textColor:kColorHEX(0x666666) textAlignment:NSTextAlignmentRight];
    }
    return _orderNoLabel;
}

- (UILabel *)orderTimeLabel {
    if (!_orderTimeLabel) {
        _orderTimeLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.orderNoLabel.x, _orderNoLabel.maxY, self.width - KScaleWidth(100.0) - KScaleWidth(16.0), _orderNoLabel.height) font:KFontSize(15.0) textColor:kColorHEX(0x666666) textAlignment:NSTextAlignmentRight];
    }
    return _orderTimeLabel;
}

- (UILabel *)getTimeLabel {
    if (!_getTimeLabel) {
        _getTimeLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.orderTimeLabel.x, _orderTimeLabel.maxY, _orderTimeLabel.width, _orderTimeLabel.height) font:KFontSize(15.0) textColor:kColorHEX(0x666666) textAlignment:NSTextAlignmentRight];
    }
    return _getTimeLabel;
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
